#ifndef __ETH_H__
#define __ETH_H__

#include <stm32f0xx.h>
#include "socket.h"

#define SOCK_TCPS                   0
#define SOCK_TCPC                   1
#define SOCK_UDPS                   2

#define LINK_TYPE_TCPS              0
#define LINK_TYPE_TCPC              1
#define LINK_TYPE_UDP               2

#define EthDataBuffSize 1700

// Default Network Configuration
extern wiz_NetInfo gEthCfg;

extern uint8_t EthDataBuff[];

extern uint16_t gTcpSPort;

extern uint8_t gTcpCAddr[4];
extern uint16_t gTcpCPort;

extern uint16_t gUdpSPort;

extern uint8_t gUdpCAddr[4];
extern uint16_t gUdpCPort;

void eth_set_net_run_delay(uint32_t delay);
void eth_disconnect(uint8_t sn);

void eth_network_init(wiz_NetInfo *ethCfg);
void eth_get_link_status(uint8_t *buff, int16_t *rxSize);

int16_t eth_tcps(uint8_t sn, uint8_t* buff, uint16_t buffSize);
int16_t eth_tcpc(uint8_t sn, uint8_t* buff, uint16_t buffSize);
int16_t eth_udp(uint8_t sn, uint8_t* buff, uint16_t buffSize);
int16_t eth_udpc(uint8_t sn, uint8_t* buff, uint16_t buffSize);

int16_t eth_tx_data(uint8_t sn, uint8_t* data, uint16_t dataSize, uint8_t LinkType);


#endif

